<?php
$this->breadcrumbs=array(
	'留言列表'=>array('admin'),
	'列表',
);

$this->menu=array(
	array('label'=>'新增消息', 'url'=>array('create')),
	array('label'=>'消息列表', 'url'=>array('admin')),
);
?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'news-grid',
	'dataProvider'=>$model->search(),
	'filter'=>$model,
	'columns'=>array(
		'nid' => array(
			'name' => 'nid',
			'headerHtmlOptions' => array('width' => '5%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'title' => array(
			'name' => 'title',
			'headerHtmlOptions' => array('width' => '30%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),		
		'recommend' => array(
			'name' => 'recommend',
			'headerHtmlOptions' => array('width' => '6%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),		
		'hot' => array(
			'name' => 'hot',
			'headerHtmlOptions' => array('width' => '6%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'dateline' => array(
			'name' => 'dateline',
			'headerHtmlOptions' => array('width' => '20%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		'updated' => array(
			'name' => 'updated',
			'headerHtmlOptions' => array('width' => '20%'),
			'htmlOptions' => array('style' => 'text-align:center;')
		),
		array(
            'class' => 'CButtonColumn',
            'header' => '操作',
            'template' => '{edit}{recommend}{delete}',
			'buttons' => array(
                'edit' => array(
                    'label' => '修改',
                    'imageUrl' => Yii::app()->baseUrl . '/images/edit.png',
                    'url' => 'Yii::app()->controller->createUrl("news/update",array("id"=>$data->nid))',
                ),
                'recommend' => array(
                    'label' => '推薦',
                    'imageUrl' => Yii::app()->baseUrl . '/images/heart.png',
                    'url' => 'Yii::app()->controller->createUrl("news/recommend",array("id"=>$data->nid))',
                ),
                'delete' => array(
                    'label' => '刪除',
                    'imageUrl' => Yii::app()->baseUrl . '/images/trash.png',
                ),
            ),    
        ),
	),
)); ?>
